/* eslint-disable no-param-reassign */
export function exchange(A: number[], i: number, j: number): number[] {
	const value = A[i]
	A[i] = A[j]
	A[j] = value
	return A
}

/**
 * Return a random integer value between start and end
 * @param start the start number
 * @param end the end number
 */
export function randomInt(start: number = 0, end: number = 1): number {
	return (
		Math.round(Math.random() * (end - start + (end >= start ? 1 : -1)) - 0.5) +
		start
	)
}
